<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>选课系统项目文档</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="https://q4.qlogo.cn/g?b=qq&amp;nk=1906249647&amp;s=640">
    <meta name="description" content="风离 & 苏才华">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/assets/css/0.styles.cdd75a34.css" as="style"><link rel="preload" href="/assets/js/app.1463cf64.js" as="script"><link rel="preload" href="/assets/js/3.027404ff.js" as="script"><link rel="preload" href="/assets/js/1.01246aca.js" as="script"><link rel="preload" href="/assets/js/11.5aad7048.js" as="script"><link rel="prefetch" href="/assets/js/10.f00be53f.js"><link rel="prefetch" href="/assets/js/12.278d760d.js"><link rel="prefetch" href="/assets/js/13.3ec88902.js"><link rel="prefetch" href="/assets/js/14.c212e7b5.js"><link rel="prefetch" href="/assets/js/15.16a5da8c.js"><link rel="prefetch" href="/assets/js/4.330d092c.js"><link rel="prefetch" href="/assets/js/5.68480449.js"><link rel="prefetch" href="/assets/js/6.412d3c2f.js"><link rel="prefetch" href="/assets/js/7.cacb4248.js"><link rel="prefetch" href="/assets/js/8.73d07ada.js"><link rel="prefetch" href="/assets/js/9.3cbabfc0.js">
    <link rel="stylesheet" href="/assets/css/0.styles.cdd75a34.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar" data-v-1aefc0b4><div data-v-1aefc0b4><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-1aefc0b4 data-v-1aefc0b4><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-25ba6db2 data-v-1aefc0b4 data-v-1aefc0b4><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>选课系统项目文档</h3> <p class="description" data-v-25ba6db2 data-v-25ba6db2>风离 &amp; 苏才华</p> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><span data-v-25ba6db2>风离</span>
            
          <!---->
          2022
        </a></span></div></div> <div class="hide" data-v-1aefc0b4><header class="navbar" data-v-1aefc0b4><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://q4.qlogo.cn/g?b=qq&amp;nk=1906249647&amp;s=640" alt="选课系统项目文档" class="logo"> <span class="site-name">选课系统项目文档</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      项目开源地址及接口文档地址
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/fl1906249647/course-selection-system.git" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.apifox.cn/apidoc/shared-42f65f6e-94ab-4a81-88ba-6c4700c21c8e" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  接口文档：密码666666
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-1aefc0b4></div> <aside class="sidebar" data-v-1aefc0b4><div class="personal-info-wrapper" data-v-39576ba9 data-v-1aefc0b4><img src="https://q4.qlogo.cn/g?b=qq&amp;nk=1906249647&amp;s=640" alt="author-avatar" class="personal-img" data-v-39576ba9> <h3 class="name" data-v-39576ba9>
    风离
  </h3> <div class="num" data-v-39576ba9><div data-v-39576ba9><h3 data-v-39576ba9>4</h3> <h6 data-v-39576ba9>Articles</h6></div> <div data-v-39576ba9><h3 data-v-39576ba9>26</h3> <h6 data-v-39576ba9>Tags</h6></div></div> <ul class="social-links" data-v-39576ba9></ul> <hr data-v-39576ba9></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      项目开源地址及接口文档地址
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/fl1906249647/course-selection-system.git" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.apifox.cn/apidoc/shared-42f65f6e-94ab-4a81-88ba-6c4700c21c8e" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  接口文档：密码666666
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav> <!----> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-25ba6db2 data-v-1aefc0b4><h3 class="title" data-v-25ba6db2 data-v-25ba6db2></h3> <!----> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><span data-v-25ba6db2>风离</span>
            
          <!---->
          2022
        </a></span></div></div> <div data-v-1aefc0b4><main class="page"><section><div class="page-title"><h1 class="title"></h1> <div data-v-f875f3fc><i class="iconfont reco-account" data-v-f875f3fc><span data-v-f875f3fc>风离</span></i> <!----> <!----> <!----></div></div> <div class="theme-reco-content content__default"><hr> <h2 id="title-基于springcloud-alibaba-分布式微服务与云原生平台kubesphere一站式devops选课系统的性能优化-web端-小程序端-date-2022-03-29"><a href="#title-基于springcloud-alibaba-分布式微服务与云原生平台kubesphere一站式devops选课系统的性能优化-web端-小程序端-date-2022-03-29" class="header-anchor">#</a> title: 基于SpringCloud Alibaba  分布式微服务与云原生平台Kubesphere一站式DevOps选课系统的性能优化(Web端+小程序端)
date: 2022-03-29</h2> <p><img src="https://img.flya.top/img/2022/03/14%E6%97%A500%E6%97%B614%E5%88%8634%E7%A7%92.png" alt=""></p> <h1 id="_1-引言"><a href="#_1-引言" class="header-anchor">#</a> 1.引言</h1> <h2 id="_1-1编写目的"><a href="#_1-1编写目的" class="header-anchor">#</a> 1.1编写目的</h2> <div class="custom-block tip"><p class="title">介绍</p><p>为了解决学生选课时系统崩溃 宕机的问题 特此编写本系统 实现选课系统的高可用与负载均衡</p></div><h2 id="_1-2背景"><a href="#_1-2背景" class="header-anchor">#</a> 1.2背景</h2> <blockquote><p>我们学校的选课系统人一多就会崩溃</p> <p>分析原因还是因为一瞬间大量人涌入选课系统 系统扛不住高并发而宕机</p> <p>本系统在此前期下 准备自己开发一款选课系统 <code>使用sentinel作为服务熔断和降级框架</code> <code>使用redisson作为分布式锁</code> <code>使用Nginx+SpringCloud Gateway 做负载均衡``使用docker+k8s做持久化自动部署</code> 保证几万学生在同一时间下 访问系统不会崩溃 宕机 <code>使用JWT作为(Token)作为系统的身份校验 授权与认证</code> 采用<code>前后端分离</code>的方式部署该系统，小组分工明确</p></blockquote> <h2 id="_1-3定义"><a href="#_1-3定义" class="header-anchor">#</a> 1.3定义</h2> <p>(列出本文件中用到的专门术语的定义和外文首字母组词的原词组。)</p> <p><code>前端</code></p> <blockquote></blockquote> <p><code>后端</code></p> <blockquote></blockquote> <p><code>部署</code></p> <blockquote></blockquote> <p><code>测试运维</code></p> <blockquote></blockquote> <h2 id="_1-4参考资料"><a href="#_1-4参考资料" class="header-anchor">#</a> 1.4参考资料</h2> <blockquote><p><code>Spring官方文档</code>： https://spring.io/</p> <p><code>MyBatisPuls官方文档</code>:  https://baomidou.com/</p> <p><code>Nacos官方文档</code>： https://nacos.io/zh-cn/</p> <p><code>Sentinel官方文档</code>： https://sentinelguard.io/zh-cn/</p> <p><code>SpringCloud中文文档</code>:  https://www.springcloud.cc/</p> <p><code>Docker官方文档</code>：https://www.docker.com/</p> <p><code>Vue官方文档</code>：https://cn.vuejs.org/</p> <p><code>elementUI官方文档</code>: https://element.eleme.cn/#/zh-CN</p> <p><code>HuTools官方文档</code>: https://hutool.cn/docs/#/</p> <p><code>Kubernetes中文社区</code>: http://docs.kubernetes.org.cn/</p> <p><code>Cloud-Platform框架文档</code>: https://gitee.com/geek_qi/cloud-platform/blob/master/dev-doc.md</p></blockquote> <h1 id="_2-项目概述"><a href="#_2-项目概述" class="header-anchor">#</a> 2.项目概述</h1> <h2 id="_2-1-工作内容"><a href="#_2-1-工作内容" class="header-anchor">#</a> 2.1 工作内容</h2> <blockquote><p>完成选课的发布 学生登录系统 及学生选课 功能 学生可查看已选课程</p> <p>扩展功能: 本校学生可登陆进本系统查看其课程表 校外考试 校内考试成绩 及绩点</p></blockquote> <h2 id="_2-2小组成员"><a href="#_2-2小组成员" class="header-anchor">#</a> 2.2小组成员</h2> <blockquote><p><code>软工1905 风 离</code>:    项目后端 技术选型 文档编写 项目部署 运维 测试</p> <blockquote><p>技术水平： 掌握常用JAVA后端技术栈 能独立开发出分布式微服务系统 有过部署经验</p></blockquote> <img src="https://img.flya.top/img/2022/03/02%E6%97%A500%E6%97%B623%E5%88%8630%E7%A7%92.jpeg" style="zoom:25%;"> <p><code>软工1904 苏才华</code>： 项目前端 思路提供者 UI设计师 前端大佬</p> <blockquote><p>技术水平：</p></blockquote> <img src="https://img.flya.top/img/2022/03/02%E6%97%A500%E6%97%B625%E5%88%8651%E7%A7%92.jpeg" style="zoom:25%;"> <p><code>软工1905 任威</code>： 项目组织者 思路提供者 LOGO设计师</p> <blockquote><p>技术水平：</p></blockquote> <img src="https://img.flya.top/img/2022/03/02%E6%97%A500%E6%97%B625%E5%88%8606%E7%A7%92.jpeg" style="zoom:25%;"></blockquote> <h2 id="_2-3-产品"><a href="#_2-3-产品" class="header-anchor">#</a> 2.3 产品</h2> <blockquote><p>基于<code>SpringCloudalibaba</code>分布式微服务 高并发选课系统</p></blockquote> <h3 id="_2-3-1-程序"><a href="#_2-3-1-程序" class="header-anchor">#</a> 2.3.1 程序</h3> <blockquote><p>（列出需移交给用户的程序的名称，所用的编程语言及存储程序的媒体形式，并通过引用有关文件，逐项说明其功能和能力。）</p></blockquote> <h3 id="_2-3-2-文件"><a href="#_2-3-2-文件" class="header-anchor">#</a> 2.3.2 文件</h3> <blockquote><p>（列出需移交给用户的每种文件的名称及内容要点。）</p></blockquote> <h3 id="_2-3-3-服务"><a href="#_2-3-3-服务" class="header-anchor">#</a> 2.3.3 服务</h3> <blockquote><p>（列出需向用户提供的各项服务，如培训安装、维护和运行支持等，应逐项规定开始日期、所提供支持的级别和服务的期限。）</p></blockquote> <h3 id="_2-3-4-非移交的产品"><a href="#_2-3-4-非移交的产品" class="header-anchor">#</a> 2.3.4 非移交的产品</h3> <blockquote><p>程序源码</p></blockquote> <h2 id="_2-4-验收标准"><a href="#_2-4-验收标准" class="header-anchor">#</a> 2.4 验收标准</h2> <blockquote><p>（对于上述这些应交出的产品和服务，逐项说明或引用资料说明验收标准。）</p></blockquote> <hr> <h1 id="_3-实施计划"><a href="#_3-实施计划" class="header-anchor">#</a> 3. 实施计划</h1> <h2 id="_3-1工作任务的分解与人员分工"><a href="#_3-1工作任务的分解与人员分工" class="header-anchor">#</a> 3.1工作任务的分解与人员分工</h2> <blockquote><p>(对于项目开发中需完成的各项工作，从需求分析、设计、实现、测试直到维护，包括文件的编制、审批、打印、分发工作，用户培训工作，软件安装工作等，按层次进行分解，指明每项任务的负责人和参加人员。)</p></blockquote> <blockquote><table><thead><tr><th style="text-align:center;">各项工作</th> <th style="text-align:center;">负责人</th> <th style="text-align:center;">参与人员</th></tr></thead> <tbody><tr><td style="text-align:center;">需求分析</td> <td style="text-align:center;">风离</td> <td style="text-align:center;">苏才华,任威</td></tr> <tr><td style="text-align:center;">数据库设计</td> <td style="text-align:center;">风离</td> <td style="text-align:center;">苏才华,任威</td></tr> <tr><td style="text-align:center;">后端接口实现</td> <td style="text-align:center;">风离</td> <td style="text-align:center;">无</td></tr> <tr><td style="text-align:center;">前端接口实现</td> <td style="text-align:center;">苏才华</td> <td style="text-align:center;">无</td></tr> <tr><td style="text-align:center;">前后端联调</td> <td style="text-align:center;">风离，苏才华</td> <td style="text-align:center;">无</td></tr> <tr><td style="text-align:center;">测试</td> <td style="text-align:center;">风离</td> <td style="text-align:center;">苏才华,任威</td></tr> <tr><td style="text-align:center;">维护</td> <td style="text-align:center;">风离</td> <td style="text-align:center;">无</td></tr> <tr><td style="text-align:center;">文件的打印、分发工作</td> <td style="text-align:center;"></td> <td style="text-align:center;"></td></tr> <tr><td style="text-align:center;">文件的编制、审批</td> <td style="text-align:center;"></td> <td style="text-align:center;"></td></tr> <tr><td style="text-align:center;">用户培训工作</td> <td style="text-align:center;"></td> <td style="text-align:center;"></td></tr> <tr><td style="text-align:center;">软件安装工作</td> <td style="text-align:center;">风离</td> <td style="text-align:center;">苏才华,任威</td></tr></tbody></table></blockquote> <h2 id="_3-2-接口人员"><a href="#_3-2-接口人员" class="header-anchor">#</a> 3.2 接口人员</h2> <hr> <blockquote><table><thead><tr><th style="text-align:center;">接口类型</th> <th style="text-align:center;">人员</th> <th style="text-align:center;">职责</th></tr></thead> <tbody><tr><td style="text-align:center;">负责本项目同用户的接口</td> <td style="text-align:center;"></td> <td style="text-align:center;"></td></tr> <tr><td style="text-align:center;">负责本项目同本单位各管理机构</td> <td style="text-align:center;"></td> <td style="text-align:center;"></td></tr> <tr><td style="text-align:center;">负责本项目同各分合同负责单位的接口</td> <td style="text-align:center;"></td> <td style="text-align:center;"></td></tr></tbody></table></blockquote> <h2 id="_3-3-进度"><a href="#_3-3-进度" class="header-anchor">#</a> 3.3 进度</h2> <ul><li>需求分析与数据库设计  2.27</li> <li>项目前后端框架选取与搭建完毕 2.28</li> <li>解决前后端跨域联调 2.28</li> <li>解决Token传输问题 用户信息接口完成 3.01</li> <li>整合Redisson完成课程信息发布 已选课程信息接口完成 整合SpringCache完成缓存优化 3.02</li> <li>全部选课预热已完成(已测试） 3.04</li> <li>选课已解决（待高并发测试）3.06</li> <li>解决重复选课 删除缓存预热完成 发布选课班 展示待参与选课班级完成 3.07</li> <li>实现线上线下环境切换  整合MongoDB实现教务系统与本地选课系统的整合 3.09</li> <li>实现全云端配置文件 3.10</li> <li>创建高并发测试案例 并通过测试 3.11</li> <li></li></ul> <h2 id="_3-4-预算"><a href="#_3-4-预算" class="header-anchor">#</a> 3.4 预算</h2> <blockquote><p>暂无</p></blockquote> <h2 id="_3-5关键问题"><a href="#_3-5关键问题" class="header-anchor">#</a> 3.5关键问题</h2> <blockquote><p>1： 中间件RabbitMQ宕机不可用问题</p> <p>2：缓存数据库 Redis 持久化问题</p> <p>3： 集群部署上线问题</p> <p>4：高并发线下实测 待测</p></blockquote> <h1 id="_4-支持条件"><a href="#_4-支持条件" class="header-anchor">#</a> 4.支持条件</h1> <h2 id="_4-1计算机系统支持"><a href="#_4-1计算机系统支持" class="header-anchor">#</a> 4.1计算机系统支持</h2> <blockquote><p>本地开发环境： Win10</p> <p>远程部署环境： Linux - Centos 7</p></blockquote> <h2 id="_4-2需由用户承担的工作"><a href="#_4-2需由用户承担的工作" class="header-anchor">#</a> 4.2需由用户承担的工作</h2> <blockquote><p>使用选课系统</p></blockquote> <h2 id="_4-3需由外单位操供的条件"><a href="#_4-3需由外单位操供的条件" class="header-anchor">#</a> 4.3需由外单位操供的条件</h2> <blockquote><p>暂未</p></blockquote> <h1 id="_5-专题计划要点"><a href="#_5-专题计划要点" class="header-anchor">#</a> 5.专题计划要点</h1> <blockquote><p>待完成</p></blockquote> <h2 id="我是分割线"><a href="#我是分割线" class="header-anchor">#</a> 我是分割线---------------------------------</h2> <h1 id="项目相关"><a href="#项目相关" class="header-anchor">#</a> 项目相关</h1> <h2 id="项目截图及在线展示"><a href="#项目截图及在线展示" class="header-anchor">#</a> 项目截图及在线展示</h2> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A523%E6%97%B632%E5%88%8626%E7%A7%92.png" alt="img"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A523%E6%97%B636%E5%88%8621%E7%A7%92.png" alt="image-20220311233621686"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A523%E6%97%B636%E5%88%8642%E7%A7%92.png" alt="image-20220311233641926"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A523%E6%97%B639%E5%88%8624%E7%A7%92.png" alt="img"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A523%E6%97%B639%E5%88%8658%E7%A7%92.png" alt="img"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A523%E6%97%B640%E5%88%8652%E7%A7%92.png" alt="img"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A523%E6%97%B642%E5%88%8617%E7%A7%92.png" alt="img"></p> <p><img src="https://img.flya.top/img/2022/03/10%E6%97%A523%E6%97%B626%E5%88%8635%E7%A7%92.png" alt="image-20220310232635063"></p> <h2 id="技术选型"><a href="#技术选型" class="header-anchor">#</a> 技术选型</h2> <blockquote><p><strong>项目前端</strong>：</p> <blockquote><p>vue-element-admin</p></blockquote> <p><strong>项目后端：</strong></p> <blockquote><p>项目基础框架： <code>SpringCloud SpringCloudAlibaba SpringBoot MybatisPlus</code></p> <p>消息中间件： <code>RabbitMQ</code></p> <p>缓存数据库： <code>Redis SpringCache Redisson</code></p> <p>对象储存： <code>SpringAlibaba OSS</code></p> <p>安全框架：<code>Spring Security</code></p> <p>网关： <code>Spring Cloud Gateway</code></p> <p>远程调用RPC： <code>OpenFeign</code></p> <p>服务降级熔断： <code>SpringCloudAliBaba Sentinel</code></p> <p>服务注册中心与配置中心： <code>SpringCloudAliBaba Nacos</code></p> <p>链路追踪： <code>spring-cloud-sleuth-zipkin</code></p> <p>项目健康状态监控： <code>Spring Boot actuator SpringBoot Admin</code></p> <p>数据库及连接池：<code>Mysql Druid</code></p> <p>工具包： <code>Hutools FastJson</code></p> <p>日志：<code>Log4j</code></p> <p>项目脚手架：<code>开源项目</code><a href="https://gitee.com/geek_qi/cloud-platform" target="_blank" rel="noopener noreferrer">Cloud-Platform<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>定时任务框架：<code>Quartz</code></p></blockquote> <p><strong>项目协作</strong></p> <blockquote><p>版本控制平台： <code>Gitee</code></p> <p>接口文档管理： <code>ApiFox</code></p> <p>远程办公： <code>ToDesk</code></p></blockquote> <p><strong>项目上线发布</strong></p> <blockquote><p>部署环境：<code>阿里云 Linux Centos （2核4G）* 2</code>+ <code>阿里云 Linux Centos （1核2G) * 2</code>+  <code>腾讯云 Linux Centos （4核16G）* 1</code></p> <p>部署工具： <code>Docker + K8s + Jenkins</code></p> <p>测试工具：<code>Jmeter</code></p></blockquote></blockquote> <h2 id="本地部署运行说明"><a href="#本地部署运行说明" class="header-anchor">#</a> 本地部署运行说明</h2> <blockquote><p>前置条件： <code>JDK1.8 Node.js 14.16.7 Maven 3.5.X Git</code></p> <p>初始化Git仓库： &gt;<code>git init</code></p> <p>前端拉取命令：</p> <div class="language-sh line-numbers-mode"><pre class="language-sh"><code><span class="token function">git</span> clone -b vue_dev https://gitee.com/fl1906249647/course-selection-system.git
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li>下载依赖及运行（在下载目录下）： npm install   npm run dev</li></ul> <p>后端拉取命令：</p> <div class="language-sh line-numbers-mode"><pre class="language-sh"><code><span class="token function">git</span> clone -b dev https://gitee.com/fl1906249647/course-selection-system.git
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ul><li><p>修改配置文件</p> <div class="language-yaml line-numbers-mode"><pre class="language-yaml"><code>yaml中所有的环境 Nacos RabbitMq Redis Mysql MongDB 账号密码端口为自己电脑本地环境配置
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></li></ul></blockquote> <blockquote><ul><li><p>安装启动RabbitMQ （读者自行百度）</p></li> <li><p>安装Nginx</p></li> <li><p>安装启动MySql （读者自行百度）</p></li> <li><p>安装启动Redis（读者自行百度）</p></li> <li><p>安装启动MongDB（读者自行百度）</p></li> <li><p>安装启动Nacos （读者自行百度）</p></li> <li><p>启动Sentinel（在下载目录里：java -jar sentinelxxx.jar）</p></li> <li><p>启动微服务顺序</p> <p><img src="https://img.flya.top/img/2022/03/07%E6%97%A517%E6%97%B650%E5%88%8636%E7%A7%92.png" alt="image-20220307175036322"></p></li></ul></blockquote> <h2 id="远程部署运行说明"><a href="#远程部署运行说明" class="header-anchor">#</a> 远程部署运行说明</h2> <h3 id="部署前端"><a href="#部署前端" class="header-anchor">#</a> 部署前端</h3> <blockquote><p>采用<code>jenkins+docker+nginx</code>  自动部署至服务器  前端只要将代码提交至Gitee 即可自动部署到 远程服务器</p> <p>参考文章</p> <p><a href="http://t.csdn.cn/bqtG1" target="_blank" rel="noopener noreferrer">http://t.csdn.cn/bqtG1<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <h2 id="部署后端"><a href="#部署后端" class="header-anchor">#</a> 部署后端</h2> <blockquote></blockquote> <h2 id="本地与线上环境切换"><a href="#本地与线上环境切换" class="header-anchor">#</a> 本地与线上环境切换</h2> <blockquote><p><img src="https://img.flya.top/img/2022/03/09%E6%97%A523%E6%97%B633%E5%88%8639%E7%A7%92.png" alt="image-20220309233339090"></p></blockquote> <h2 id="数据库设计"><a href="#数据库设计" class="header-anchor">#</a> 数据库设计</h2> <h3 id="课程与课程班的对应关系"><a href="#课程与课程班的对应关系" class="header-anchor">#</a> <font color="red">课程与课程班的对应关系</font></h3> <p><img src="https://img.flya.top/img/2022/03/05%E6%97%A522%E6%97%B605%E5%88%8606%E7%A7%92.png" alt="image-20220305220506536"></p> <h3 id="课程班与选课学生的对应关系"><a href="#课程班与选课学生的对应关系" class="header-anchor">#</a> <font color="red">课程班与选课学生的对应关系</font></h3> <p><img src="https://img.flya.top/img/2022/03/05%E6%97%A522%E6%97%B617%E5%88%8648%E7%A7%92.png" alt="image-20220305221748504"></p> <h2 id="选课流程"><a href="#选课流程" class="header-anchor">#</a> 选课流程</h2> <blockquote><p>所有流程图在线预览地址：</p> <p>https://www.processon.com/view/link/6223834b0e3e74108ca0a57f</p> <p>密码： I84H</p></blockquote> <h3 id="核心流程1-选课预热-发布选课信息"><a href="#核心流程1-选课预热-发布选课信息" class="header-anchor">#</a> <font color="green">核心流程1： 选课预热 发布选课信息 </font></h3> <p><img src="https://img.flya.top/img/2022/03/05%E6%97%A523%E6%97%B630%E5%88%8614%E7%A7%92.png" alt="image-20220305233013851"></p> <p><img src="https://img.flya.top/img/2022/03/05%E6%97%A523%E6%97%B630%E5%88%8641%E7%A7%92.png" alt="image-20220305233041860"></p> <p><img src="https://img.flya.top/img/2022/03/05%E6%97%A523%E6%97%B630%E5%88%8655%E7%A7%92.png" alt="image-20220305233055350"></p> <h3 id="发布待选课程信息"><a href="#发布待选课程信息" class="header-anchor">#</a> 发布待选课程信息</h3> <ul><li>传入待选课程班id 以及 最大选课人数</li> <li>Redis缓存待选课程信息 及可选数量
<ul><li><blockquote><p>这里可选数量与课程信息分开 依靠随机码相互连接</p></blockquote></li> <li><blockquote><p>通过redisson加分布式锁</p> <p>由于选课服务部署在集群，因此每个服务器都会同时将数据缓存到redis，但我们只需要让数据缓存一次。</p> <p>因此不仅需要在缓存前<code>判断key的存在</code>，还需要<code>加分布式锁保证只有一条线程缓存数据</code>。</p> <p>由于这种多线程同时缓存的情况只会出现一次，因此我们不采用默认的看门狗机制(默认30秒续期 直到该方法结束)，而是<code>给锁加几秒钟过期时间</code>就可。</p></blockquote> <p><strong>随机码如何防恶意请求：</strong></p> <p>前端将随机码拼在选课的url上，因此单纯结合课程班id发请求是无效的。选课开始时（定时任务）后端才将随机码返回给前端，只有选课开始才能抢课。</p> <p>redis中分布式信号量的key是和课程班随机码绑定的，因此只有随机码正确才能查找到课程班对应的分布式信号量。</p></li></ul></li></ul> <p>​</p> <ul><li>返回发布成功即可 这个时间应该比较长 大概3~4 秒 （但只要保证学生展示待选课程从Redis中读取 毫秒级响应即可）</li></ul> <h3 id="核心2-学生选课"><a href="#核心2-学生选课" class="header-anchor">#</a> <font color="green">核心2：学生选课</font></h3> <p><img src="https://img.flya.top/img/2022/03/06%E6%97%A500%E6%97%B622%E5%88%8618%E7%A7%92.png" alt="image-20220306002217654"></p> <h3 id="展示待选课程信息"><a href="#展示待选课程信息" class="header-anchor">#</a> 展示待选课程信息</h3> <p>老师立即可见</p> <p>学生只有在选课时间开始时才可见</p> <h3 id=""><a href="#" class="header-anchor">#</a></h3> <h3 id="学生退选课程"><a href="#学生退选课程" class="header-anchor">#</a> 学生退选课程</h3> <h2 id="解决项目中的问题"><a href="#解决项目中的问题" class="header-anchor">#</a> 解决项目中的问题</h2> <h3 id="redis"><a href="#redis" class="header-anchor">#</a> Redis</h3> <ul><li></li></ul> <blockquote><h2 id="springboot连接远程redis出现-java-io-ioexception-远程主机强迫关闭了一个现有的连接"><a href="#springboot连接远程redis出现-java-io-ioexception-远程主机强迫关闭了一个现有的连接" class="header-anchor">#</a> springboot连接远程redis出现 java.io.IOException: 远程主机强迫关闭了一个现有的连接</h2> <div class="language-java line-numbers-mode"><pre class="language-java"><code>spring	
	redis<span class="token operator">:</span>
	    host<span class="token operator">:</span> 
	    port<span class="token operator">:</span> <span class="token number">6379</span>
	    password<span class="token operator">:</span> 
	    database<span class="token operator">:</span> <span class="token number">1</span>
	    timeout<span class="token operator">:</span> <span class="token number">60</span>s
	    ## springboot2<span class="token punctuation">.</span><span class="token number">0</span>之后将连接池由jedis改为lettuce
	    lettuce<span class="token operator">:</span>
	      pool<span class="token operator">:</span>
	        max<span class="token operator">-</span>idle<span class="token operator">:</span> <span class="token number">30</span>
	        max<span class="token operator">-</span>active<span class="token operator">:</span> <span class="token number">8</span>
	        max<span class="token operator">-</span>wait<span class="token operator">:</span> <span class="token number">10000</span>
	        min<span class="token operator">-</span>idle<span class="token operator">:</span> <span class="token number">10</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><p>Redis.conf</p> <div class="language-sh line-numbers-mode"><pre class="language-sh"><code>tcp-keepalive <span class="token number">300</span> <span class="token comment"># 保持长连接300s并重启Redis</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></blockquote> <ul><li><p>Redis 重启后密码失效</p> <blockquote><p>Redis.conf</p> <div class="language-sh line-numbers-mode"><pre class="language-sh"><code>requirepass  密码 <span class="token comment"># 设置密码持久化 并重启Redis</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></blockquote></li> <li><p>Redis分布式锁本地连接远程失败</p> <blockquote><p>Caused by: <em>org</em>.<em>redisson</em>.<em>client</em>.<em>RedisResponseTimeoutException</em>: <em>Redis server response timeout</em> (<em>3000 ms</em>) <em>occured after 3 retry attempts</em>.</p></blockquote></li></ul> <p>解决：</p> <blockquote><p><a href="https://plu.one/%E5%90%8E%E7%AB%AF%E5%BC%80%E5%8F%91/2020/07/01/redisson-RedisResponseTimeoutException/" target="_blank" rel="noopener noreferrer">出处<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token annotation punctuation">@Bean</span>
<span class="token keyword">public</span> <span class="token class-name">RedissonClient</span> <span class="token function">redissonClient</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token class-name">Config</span> config <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Config</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    config<span class="token punctuation">.</span><span class="token function">useSingleServer</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">// 使用单机模式</span>
        <span class="token punctuation">.</span><span class="token function">setAddress</span><span class="token punctuation">(</span><span class="token string">&quot;redis://&quot;</span> <span class="token operator">+</span> redisHost <span class="token operator">+</span> <span class="token string">&quot;:&quot;</span> <span class="token operator">+</span> redisPort<span class="token punctuation">)</span>
        <span class="token punctuation">.</span><span class="token function">setKeepAlive</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span>
        <span class="token comment">// 设置1秒钟ping一次来维持连接</span>
        <span class="token punctuation">.</span><span class="token function">setPingConnectionInterval</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span>
        <span class="token punctuation">.</span><span class="token function">setPassword</span><span class="token punctuation">(</span>redisPass<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> <span class="token class-name">Redisson</span><span class="token punctuation">.</span><span class="token function">create</span><span class="token punctuation">(</span>config<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div></blockquote> <h3 id="nacos-配置中心不生效"><a href="#nacos-配置中心不生效" class="header-anchor">#</a> Nacos 配置中心不生效</h3> <blockquote><p>导入这个依赖 原因： bootstrap.yml未生效</p></blockquote> <blockquote><dependency><groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-bootstrap</artifactId></dependency></blockquote> <h3 id="quartz"><a href="#quartz" class="header-anchor">#</a> quartz</h3> <blockquote><p>springboot整合quartz遇到的错误</p></blockquote> <blockquote><p>1、spring boot整合quartz执行多个定时任务时报：</p> <p>org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'group1.job1', because one already exists with this identification.</p> <p><code>解决办法： 在初始化调度的时候clean一下： scheduler.clear();</code></p></blockquote> <h2 id="项目-高并发本地测压"><a href="#项目-高并发本地测压" class="header-anchor">#</a> 项目 高并发本地测压</h2> <h3 id="创建1000个测试用户并生成各自的token-存入user-txt文件等待测试"><a href="#创建1000个测试用户并生成各自的token-存入user-txt文件等待测试" class="header-anchor">#</a> 创建1000个测试用户并生成各自的token 存入user.txt文件等待测试</h3> <div class="language-java line-numbers-mode"><pre class="language-java"><code> <span class="token annotation punctuation">@GetMapping</span><span class="token punctuation">(</span><span class="token string">&quot;/batchInsertUser&quot;</span><span class="token punctuation">)</span>  <span class="token comment">//@RequestParam(value = &quot;date&quot;)Integer date,@RequestParam(&quot;size&quot;)Integer size</span>
    <span class="token keyword">public</span> <span class="token class-name">BaseResponse</span> <span class="token function">batchInsertUser</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">throws</span> <span class="token class-name">Exception</span> <span class="token punctuation">{</span>
        <span class="token keyword">int</span> firstId <span class="token operator">=</span><span class="token number">3110000</span><span class="token punctuation">;</span>
        <span class="token keyword">int</span> size<span class="token operator">=</span><span class="token number">1000</span><span class="token punctuation">;</span>
        <span class="token class-name">String</span> username <span class="token operator">=</span> firstId<span class="token operator">+</span><span class="token string">&quot;&quot;</span><span class="token punctuation">;</span>
        <span class="token class-name">String</span> password <span class="token operator">=</span> <span class="token string">&quot;123456&quot;</span><span class="token punctuation">;</span>
        permissionService<span class="token punctuation">.</span><span class="token function">insertFirstUser</span><span class="token punctuation">(</span>firstId<span class="token punctuation">,</span>username<span class="token punctuation">,</span>password<span class="token punctuation">)</span><span class="token punctuation">;</span>


        <span class="token comment">// 2203110000</span>
        <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> size<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">int</span> newId <span class="token operator">=</span> firstId<span class="token operator">+</span>i<span class="token punctuation">;</span>
            <span class="token class-name">String</span> uname <span class="token operator">=</span> newId<span class="token operator">+</span><span class="token string">&quot;&quot;</span><span class="token punctuation">;</span>
            log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span>uname<span class="token operator">+</span><span class="token string">&quot;---&quot;</span><span class="token operator">+</span>i<span class="token punctuation">)</span><span class="token punctuation">;</span>
            permissionService<span class="token punctuation">.</span><span class="token function">insertUser</span><span class="token punctuation">(</span>uname<span class="token punctuation">,</span>password<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

        <span class="token class-name">File</span> file <span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span><span class="token string">&quot;D:/Users/Administrator/Desktop/user.txt&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>file<span class="token punctuation">.</span><span class="token function">exists</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            file<span class="token punctuation">.</span><span class="token function">delete</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        file<span class="token punctuation">.</span><span class="token function">createNewFile</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token class-name">BufferedWriter</span> out <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">BufferedWriter</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">FileWriter</span><span class="token punctuation">(</span>file<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        
        <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>size<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token class-name">JWTInfo</span> jwtInfo <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JWTInfo</span><span class="token punctuation">(</span>firstId<span class="token operator">+</span>i <span class="token operator">+</span> <span class="token string">&quot;&quot;</span> <span class="token punctuation">,</span>firstId<span class="token operator">+</span>i <span class="token operator">+</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">,</span>firstId<span class="token operator">+</span>i <span class="token operator">+</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token comment">// 这里生成token 并派发</span>
            <span class="token class-name">String</span> token <span class="token operator">=</span> jwtTokenUtil<span class="token punctuation">.</span><span class="token function">generateToken</span><span class="token punctuation">(</span>jwtInfo<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token class-name">String</span> myId <span class="token operator">=</span> firstId<span class="token operator">+</span>i <span class="token operator">+</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">;</span>
            <span class="token comment">//JWT记录写入Redis</span>
            <span class="token function">writeOnlineLog</span><span class="token punctuation">(</span>jwtInfo<span class="token punctuation">)</span><span class="token punctuation">;</span>
            out<span class="token punctuation">.</span><span class="token function">write</span><span class="token punctuation">(</span>myId<span class="token operator">+</span><span class="token string">&quot;,&quot;</span><span class="token operator">+</span>token<span class="token operator">+</span><span class="token string">&quot;\r\n&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// \r\n即为换行</span>
        <span class="token punctuation">}</span>
        out<span class="token punctuation">.</span><span class="token function">flush</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 把缓存区内容压入文件</span>
        out<span class="token punctuation">.</span><span class="token function">close</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>


        <span class="token keyword">return</span>  <span class="token keyword">new</span> <span class="token class-name">BaseResponse</span><span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">,</span><span class="token string">&quot;插入成功&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br></div></div><h3 id="创建线程组-1000个线程-3次循环"><a href="#创建线程组-1000个线程-3次循环" class="header-anchor">#</a> 创建线程组 1000个线程 3次循环</h3> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A520%E6%97%B640%E5%88%8645%E7%A7%92.png" alt="image-20220311204044965"></p> <h3 id="user-txt文件导入测试"><a href="#user-txt文件导入测试" class="header-anchor">#</a> user.txt文件导入测试</h3> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A520%E6%97%B642%E5%88%8615%E7%A7%92.png" alt="image-20220311204214954"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A520%E6%97%B642%E5%88%8657%E7%A7%92.png" alt="image-20220311204257614"></p> <h3 id="清除缓存预热"><a href="#清除缓存预热" class="header-anchor">#</a> 清除缓存预热</h3> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A520%E6%97%B655%E5%88%8649%E7%A7%92.png" alt="image-20220311205549089"></p> <h3 id="选课预热-一门课-限选60人-1000人并发访问"><a href="#选课预热-一门课-限选60人-1000人并发访问" class="header-anchor">#</a> 选课预热 一门课 限选60人 （1000人并发访问）</h3> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A520%E6%97%B656%E5%88%8648%E7%A7%92.png" alt="image-20220311205648150"></p> <h3 id="查看选课状态"><a href="#查看选课状态" class="header-anchor">#</a> 查看选课状态</h3> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A521%E6%97%B609%E5%88%8659%E7%A7%92.png" alt="image-20220311210959030"></p> <h3 id="启动测试"><a href="#启动测试" class="header-anchor">#</a> 启动测试</h3> <h3 id="查看结果树与报告"><a href="#查看结果树与报告" class="header-anchor">#</a> 查看结果树与报告</h3> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A521%E6%97%B625%E5%88%8611%E7%A7%92.png" alt="image-20220311212511192"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A521%E6%97%B625%E5%88%8640%E7%A7%92.png" alt="image-20220311212540352"></p> <p><img src="https://img.flya.top/img/2022/03/11%E6%97%A521%E6%97%B626%E5%88%8625%E7%A7%92.png" alt="image-20220311212625289"></p> <h3 id="判断学生是否重复选课"><a href="#判断学生是否重复选课" class="header-anchor">#</a> 判断学生是否重复选课</h3> <blockquote><div class="language-mysql line-numbers-mode"><pre class="language-text"><code>SELECT * FROM
              (SELECT `student_id`,COUNT(*) AS c
              FROM st_courseclass_student GROUP BY `student_id`) t WHERE c&gt;1;
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div></blockquote></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">3/30/2022, 9:15:30 PM</span></div></footer> <!----> <div class="comments-wrapper"><!----></div> <ul class="side-bar sub-sidebar-wrapper" style="width:12rem;" data-v-cb1513f6><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#title-基于springcloud-alibaba-分布式微服务与云原生平台kubesphere一站式devops选课系统的性能优化-web端-小程序端-date-2022-03-29" class="sidebar-link reco-side-title-基于springcloud-alibaba-分布式微服务与云原生平台kubesphere一站式devops选课系统的性能优化-web端-小程序端-date-2022-03-29" data-v-cb1513f6>title: 基于SpringCloud Alibaba  分布式微服务与云原生平台Kubesphere一站式DevOps选课系统的性能优化(Web端+小程序端)
date: 2022-03-29</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_1-1编写目的" class="sidebar-link reco-side-_1-1编写目的" data-v-cb1513f6>1.1编写目的</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_1-2背景" class="sidebar-link reco-side-_1-2背景" data-v-cb1513f6>1.2背景</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_1-3定义" class="sidebar-link reco-side-_1-3定义" data-v-cb1513f6>1.3定义</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_1-4参考资料" class="sidebar-link reco-side-_1-4参考资料" data-v-cb1513f6>1.4参考资料</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_2-1-工作内容" class="sidebar-link reco-side-_2-1-工作内容" data-v-cb1513f6>2.1 工作内容</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_2-2小组成员" class="sidebar-link reco-side-_2-2小组成员" data-v-cb1513f6>2.2小组成员</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_2-3-产品" class="sidebar-link reco-side-_2-3-产品" data-v-cb1513f6>2.3 产品</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#_2-3-1-程序" class="sidebar-link reco-side-_2-3-1-程序" data-v-cb1513f6>2.3.1 程序</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#_2-3-2-文件" class="sidebar-link reco-side-_2-3-2-文件" data-v-cb1513f6>2.3.2 文件</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#_2-3-3-服务" class="sidebar-link reco-side-_2-3-3-服务" data-v-cb1513f6>2.3.3 服务</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#_2-3-4-非移交的产品" class="sidebar-link reco-side-_2-3-4-非移交的产品" data-v-cb1513f6>2.3.4 非移交的产品</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_2-4-验收标准" class="sidebar-link reco-side-_2-4-验收标准" data-v-cb1513f6>2.4 验收标准</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_3-1工作任务的分解与人员分工" class="sidebar-link reco-side-_3-1工作任务的分解与人员分工" data-v-cb1513f6>3.1工作任务的分解与人员分工</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_3-2-接口人员" class="sidebar-link reco-side-_3-2-接口人员" data-v-cb1513f6>3.2 接口人员</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_3-3-进度" class="sidebar-link reco-side-_3-3-进度" data-v-cb1513f6>3.3 进度</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_3-4-预算" class="sidebar-link reco-side-_3-4-预算" data-v-cb1513f6>3.4 预算</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_3-5关键问题" class="sidebar-link reco-side-_3-5关键问题" data-v-cb1513f6>3.5关键问题</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_4-1计算机系统支持" class="sidebar-link reco-side-_4-1计算机系统支持" data-v-cb1513f6>4.1计算机系统支持</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_4-2需由用户承担的工作" class="sidebar-link reco-side-_4-2需由用户承担的工作" data-v-cb1513f6>4.2需由用户承担的工作</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#_4-3需由外单位操供的条件" class="sidebar-link reco-side-_4-3需由外单位操供的条件" data-v-cb1513f6>4.3需由外单位操供的条件</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#我是分割线" class="sidebar-link reco-side-我是分割线" data-v-cb1513f6>我是分割线---------------------------------</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#项目截图及在线展示" class="sidebar-link reco-side-项目截图及在线展示" data-v-cb1513f6>项目截图及在线展示</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#技术选型" class="sidebar-link reco-side-技术选型" data-v-cb1513f6>技术选型</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#本地部署运行说明" class="sidebar-link reco-side-本地部署运行说明" data-v-cb1513f6>本地部署运行说明</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#远程部署运行说明" class="sidebar-link reco-side-远程部署运行说明" data-v-cb1513f6>远程部署运行说明</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#部署前端" class="sidebar-link reco-side-部署前端" data-v-cb1513f6>部署前端</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#部署后端" class="sidebar-link reco-side-部署后端" data-v-cb1513f6>部署后端</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#本地与线上环境切换" class="sidebar-link reco-side-本地与线上环境切换" data-v-cb1513f6>本地与线上环境切换</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#数据库设计" class="sidebar-link reco-side-数据库设计" data-v-cb1513f6>数据库设计</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#课程与课程班的对应关系" class="sidebar-link reco-side-课程与课程班的对应关系" data-v-cb1513f6></a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#课程班与选课学生的对应关系" class="sidebar-link reco-side-课程班与选课学生的对应关系" data-v-cb1513f6></a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#选课流程" class="sidebar-link reco-side-选课流程" data-v-cb1513f6>选课流程</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#核心流程1-选课预热-发布选课信息" class="sidebar-link reco-side-核心流程1-选课预热-发布选课信息" data-v-cb1513f6></a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#发布待选课程信息" class="sidebar-link reco-side-发布待选课程信息" data-v-cb1513f6>发布待选课程信息</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#核心2-学生选课" class="sidebar-link reco-side-核心2-学生选课" data-v-cb1513f6></a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#展示待选课程信息" class="sidebar-link reco-side-展示待选课程信息" data-v-cb1513f6>展示待选课程信息</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#" class="sidebar-link reco-side-" data-v-cb1513f6></a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#学生退选课程" class="sidebar-link reco-side-学生退选课程" data-v-cb1513f6>学生退选课程</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#解决项目中的问题" class="sidebar-link reco-side-解决项目中的问题" data-v-cb1513f6>解决项目中的问题</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#redis" class="sidebar-link reco-side-redis" data-v-cb1513f6>Redis</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#springboot连接远程redis出现-java-io-ioexception-远程主机强迫关闭了一个现有的连接" class="sidebar-link reco-side-springboot连接远程redis出现-java-io-ioexception-远程主机强迫关闭了一个现有的连接" data-v-cb1513f6>springboot连接远程redis出现 java.io.IOException: 远程主机强迫关闭了一个现有的连接</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#nacos-配置中心不生效" class="sidebar-link reco-side-nacos-配置中心不生效" data-v-cb1513f6>Nacos 配置中心不生效</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#quartz" class="sidebar-link reco-side-quartz" data-v-cb1513f6>quartz</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/doc.html#项目-高并发本地测压" class="sidebar-link reco-side-项目-高并发本地测压" data-v-cb1513f6>项目 高并发本地测压</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#创建1000个测试用户并生成各自的token-存入user-txt文件等待测试" class="sidebar-link reco-side-创建1000个测试用户并生成各自的token-存入user-txt文件等待测试" data-v-cb1513f6>创建1000个测试用户并生成各自的token 存入user.txt文件等待测试</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#创建线程组-1000个线程-3次循环" class="sidebar-link reco-side-创建线程组-1000个线程-3次循环" data-v-cb1513f6>创建线程组 1000个线程 3次循环</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#user-txt文件导入测试" class="sidebar-link reco-side-user-txt文件导入测试" data-v-cb1513f6>user.txt文件导入测试</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#清除缓存预热" class="sidebar-link reco-side-清除缓存预热" data-v-cb1513f6>清除缓存预热</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#选课预热-一门课-限选60人-1000人并发访问" class="sidebar-link reco-side-选课预热-一门课-限选60人-1000人并发访问" data-v-cb1513f6>选课预热 一门课 限选60人 （1000人并发访问）</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#查看选课状态" class="sidebar-link reco-side-查看选课状态" data-v-cb1513f6>查看选课状态</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#启动测试" class="sidebar-link reco-side-启动测试" data-v-cb1513f6>启动测试</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#查看结果树与报告" class="sidebar-link reco-side-查看结果树与报告" data-v-cb1513f6>查看结果树与报告</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/doc.html#判断学生是否重复选课" class="sidebar-link reco-side-判断学生是否重复选课" data-v-cb1513f6>判断学生是否重复选课</a></li></ul></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div></div></div>
    <script src="/assets/js/app.1463cf64.js" defer></script><script src="/assets/js/3.027404ff.js" defer></script><script src="/assets/js/1.01246aca.js" defer></script><script src="/assets/js/11.5aad7048.js" defer></script>
  </body>
</html>
